package com.example.takeaway.controller;


import com.example.takeaway.common.R;
import com.example.takeaway.entity.Orders;
import com.example.takeaway.service.OrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/order")
@AllArgsConstructor
public class OrderController {

    private final OrderService orderService;

    /**
     * 用户下单
     * @param orders
     * @return
     */

    @PostMapping("/submit")
    public R<String> submit(@RequestBody  Orders orders){

        log.info("用户下单数据----------->{}",orders.toString());
        orderService.submit(orders);


        return R.success("下单成功");
    }


}
